home *** CD-ROM | disk | FTP | other *** search
- property UpCM, DownCM, button_active, whichevent, WhichSound, WhichChannel, StartImmediately
-
- on getPropertyDescriptionList
- set description to [:]
- if the currentSpriteNum = 0 then
- set memdefault to 0
- else
- set memref to the member of sprite the currentSpriteNum
- set castLibNum to the castLibNum of memref
- set memdefault to member (the memberNum of member memref + 1) of castLib castLibNum
- end if
- addProp(description, #DownCM, [#default: memdefault, #format: #bitmap, #comment: "Pict for Down:"])
- addProp(description, #whichevent, [#default: #mouseUp, #format: #symbol, #comment: "Play Sound On Which Event:", #range: [#mouseUp, #mouseDown, #mouseEnter, #mouseLeave, #mouseUpOutSide]])
- addProp(description, #WhichChannel, [#default: 1, #format: #integer, #comment: "Which sound channel:"])
- addProp(description, #WhichSound, [#default: EMPTY, #format: #sound, #comment: "Which cast member:"])
- addProp(description, #StartImmediately, [#default: 0, #format: #boolean, #comment: "Start Immediately?:"])
- return description
- end
-
- on getBehaviorDescription
- return "Button, auto set up pict, switch pict down, Play a sound cast member. If the cast member is linked channel 1 only."
- end
-
- on getAssocMembers
- set myPropList to [DownCM, WhichSound]
- return myPropList
- end
-
- on beginSprite me
- set the UpCM of me to the member of sprite the spriteNum of me
- set the button_active of me to 0
- puppetSprite(the spriteNum of me, 1)
- end
-
- on endSprite me
- puppetSprite(the spriteNum of me, 0)
- end
-
- on do_it me
- puppetSound(the WhichChannel of me, the WhichSound of me)
- if the StartImmediately of me then
- updateStage()
- end if
- end
-
- on mouseDown me
- set the member of sprite the spriteNum of me to member the DownCM of me
- set the button_active of me to 1
- if the whichevent of me = #mouseDown then
- do_it(me)
- end if
- end
-
- on mouseUp me
- set the member of sprite the spriteNum of me to member the UpCM of me
- set the button_active of me to 0
- if the whichevent of me = #mouseUp then
- do_it(me)
- end if
- end
-
- on mouseUpOutSide me
- set the button_active of me to 0
- if the whichevent of me = #mouseUpOutSide then
- do_it(me)
- end if
- end
-
- on mouseLeave me
- if the button_active of me then
- set the member of sprite the spriteNum of me to member the UpCM of me
- end if
- if the whichevent of me = #mouseLeave then
- do_it(me)
- end if
- end
-
- on mouseEnter me
- if the button_active of me then
- set the member of sprite the spriteNum of me to member the DownCM of me
- end if
- if the whichevent of me = #mouseEnter then
- do_it(me)
- end if
- end
-